<!--
  @author tanlei
  @since 2021/07/06 14:52
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<div class="layui-card-body" th:fragment="new_order_send_order">
    <form method="POST" action="" class="layui-form" lay-filter="zmn-form" id="zmn-form">
<!--    <div class="layui-form-mid layui-word-aux" style="display: block" th:if="${obj.distributeWay == 10}">-->
<!--        说明: 平台直派为平台直接派单给工程师，派单前无对应服务商-->
<!--    </div>-->
    <hr th:if="${obj.distributeWay == 10}" class="layui-bg-gray">
    <div class="layui-card" th:if="${obj.distributeWay == 10}">
        <div class="layui-card-header">城市信息：</div>
        <div class="layui-card-body layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">省市</label>
                <div class="layui-input-block">
                    <div class="layui-inline">
                        <div id="province" style="width: 180px;"></div>
                    </div>
                    <div class="layui-inline">
                        <div id="city" style="width: 180px;"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-card">
        <div class="layui-row">
            <div class="layui-col-sm10 layui-form">
                <div class="layui-form-item" style="margin-top: 10px">
                    <label class="layui-form-label">服务平台</label>
                    <div class="layui-input-inline" style="width:200px;">
                        <select name="plat" id="plat" lay-filter="plat" lay-verify="required"
                                th:classappend="${obj.plat == null ? '' : 'layui-disabled'}"
                                th:disabled="roundsEnable">
                            <option value="" th:selected="${0 == obj.plat}">全部</option>
                            <option th:value="${item.key}"
                                    th:text="${item.value}"
                                    th:selected="${item.key == obj.plat}"
                                    th:each="item:${platList}">平台
                            </option>
                        </select>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-row">
            <div class="layui-col-sm10 layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">新单简单派单</label>
                    <div class="layui-input-inline" style="width: 60px">
                        <input type="checkbox" id="newSimpleStatus" name="newSimpleStatus" lay-verify="required"
                               th:checked="${obj.newSimpleStatus == 2}"
                               lay-filter="newSimpleStatus"
                               lay-text="ON|OFF" value="2" lay-skin="switch"/>
                    </div>
                    <div class="layui-form-mid layui-word-aux">针对：新单&普通派单，打开状态，即：只会判断基础条件</div>
                </div>
            </div>
        </div>

        <div class="layui-row">
            <div class="layui-col-sm10">
                <div class="layui-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label layui-form-required">新单自动派单</label>
                        <div class="layui-input-block">
                            <input type="radio" name="autoStatusNew" value="2" title="推荐自动派"
                                   lay-filter="autoStatusNew"
                                   th:checked="${obj.autoStatusNew == 2 || obj.autoStatusNew == null}">
                            <input type="radio" name="autoStatusNew" value="3" title="指定工程师自动派"
                                   lay-filter="autoStatusNew"
                                   th:checked="${obj.autoStatusNew == 3}"
                                   th:disabled="${obj.newSimpleStatus == 1}">
                            <input type="radio" name="autoStatusNew" value="4" title="公平自动派单"
                                   lay-filter="autoStatusNew"
                                   th:checked="${obj.autoStatusNew == 4}">
                            <input type="radio" name="autoStatusNew" value="1" title="关闭自动派"
                                   lay-filter="autoStatusNew"
                                   th:checked="${obj.autoStatusNew == 1}"
                                   th:disabled="${obj.newSimpleStatus == 1}">
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-row">
            <div class="layui-col-sm10">
                <div class="layui-form-item">
                    <label class="layui-form-label">自动派单时间</label>
                    <div class="layui-input-inline">
                        <input type="text"
                               name="autoTimeStr"
                               id="autoTimeStr"
                               class="layui-input"/>
                    </div>
                    <div class="layui-form-mid layui-word-aux">在对应时间段内，自动派单</div>
                </div>
            </div>
        </div>

        <div class="layui-row">
            <div class="layui-col-md10 layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label layui-form-required">新单派单权重</label>
                    <div class="layui-form-item" th:each="relation:${obj.distributeWeightRelationList}">
                        <label class="layui-form-label" th:if="${relation.weightType == 1}" style="margin-left: 3%;">直营工程师：</label>
                        <label class="layui-form-label" th:if="${relation.weightType == 2}" style="margin-left: 4%;">非直营工程师：</label>
                        <div class="layui-form-item">
                            <div class="layui-input-inline" style="width: 600px; margin-left: 5%;">
                                <table class="layui-hide" th:id="zmn-table-+${relation.weightType}"
                                       th:lay-filter="zmn-table-+${relation.weightType}">
                                    <thead>
                                    <tr>
                                        <th lay-data="{field:'relationId',hide: true}">
                                            派单关联id
                                        </th>
                                        <th lay-data="{field:'weightType',hide: true}">
                                            权重类型
                                        </th>
                                        <th lay-data="{field:'distributeApplication',hide: true}">
                                            派单应用
                                        </th>
                                        <th lay-data="{field:'distributeConfigId',hide: true}">
                                            派单配置id
                                        </th>
                                        <th lay-data="{field:'distanceWeight', edit:true, unresize:true, align:'center'}">
                                            距离
                                        </th>
                                        <th lay-data="{field:'handlerWeight', edit:true, unresize:true, align:'center'}">
                                            手头单占比
                                        </th>
                                        <th lay-data="{field:'distributeNewCount', edit:true, unresize:true, align:'center'}">
                                            新单派单量
                                        </th>
                                        <th lay-data="{field:'starLevelScoreWeight', width:110, edit:true, unresize:true, align:'center'}">
                                            星级分
                                        </th>
                                        <th lay-data="{field:'serveScore', edit:true, unresize:true, align:'center'}">
                                            服务分
                                        </th>
                                        <th lay-data="{field:'datumOrderHourRatio', edit:true, unresize:true, align:'center'}">
                                            单时比
                                        </th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td th:text="${relation.relationId}"></td>
                                        <td th:text="${relation.weightType}"></td>
                                        <td th:text="${relation.distributeApplication}"></td>
                                        <td th:text="${relation.distributeConfigId}"></td>
                                        <td th:text="${relation.distanceWeight}"></td>
                                        <td th:text="${relation.handlerWeight}"></td>
                                        <td th:text="${relation.distributeNewCount}"></td>
                                        <td th:text="${relation.starLevelScoreWeight}"></td>
                                        <td th:text="${relation.serveScore}"></td>
                                        <td th:text="${relation.datumOrderHourRatio}"></td>
                                    </tr>
                                    </tbody>
                                </table>
                                <div class="layui-form-mid layui-word-aux">仅针对：新单推荐自动派，权重之和为：100；自动派单设置为：推荐自动派时生效；</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-row" th:if="${obj.distributeWay == 10}">
            <div class="layui-col-sm10 layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">直营/非直营轮次单量</label>
                    <div class="layui-input-inline" style="width: 120px">
                        <input type="text" name="directSaleCount" id="directSaleCount"
                               lay-verify="numberLimit"
                               th:disabled="${obj.roundsEnable == 1}"
                               th:classappend="${obj.roundsEnable == 1 ? 'layui-disabled' : ''}"
                               placeholder="直营轮次单量" autocomplete="off" class="layui-input"
                               th:value="${obj.directSaleCount}"/>
                    </div>
                    <div class="layui-input-inline" style="width: auto">
                        <span>-</span>
                    </div>
                    <div class="layui-input-inline" style="width: 120px">
                        <input type="text" name="nonDirectCount" id="nonDirectCount"
                               lay-verify="numberLimit"
                               th:disabled="${obj.roundsEnable == 1}"
                               th:classappend="${obj.roundsEnable == 1 ? 'layui-disabled' : ''}"
                               placeholder="非直营轮次单量" autocomplete="off" class="layui-input"
                               th:value="${obj.nonDirectCount}"/>
                    </div>
                    <div class="layui-input-inline" style="width: 80px">
                        <input type="checkbox" name="roundsEnable" th:checked="${obj.roundsEnable == 2}"
                               lay-skin="switch" lay-filter="roundsEnable" lay-text="ON|OFF">
                    </div>
                </div>
            </div>
        </div>
        <zmn th:if="${obj.distributePlatId>0}">
            <div class="layui-card-header layui-margin-b"><b>其他信息</b></div>

            <div class="layui-form-item layui-form-item-sm">
                <label class="layui-form-label">修改人/时间：</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid layui-word-aux"
                         th:text="${obj.updater} + '&nbsp;/&nbsp;' + ${#dates.format(obj.updateTime, 'yyyy-MM-dd HH:mm:ss')}">
                        修改人/时间
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-form-item-sm">
                <label class="layui-form-label">创建人/时间：</label>
                <div class="layui-input-block">
                    <div class="layui-form-mid layui-word-aux"
                         th:text="${obj.creater} + '&nbsp;/&nbsp;' + ${#dates.format(obj.createTime, 'yyyy-MM-dd HH:mm:ss')}">
                        创建人/时间
                    </div>
                </div>
            </div>
        </zmn>
        <div class="layui-row">
            <div class="layui-col-sm10">
                <div class="layui-form-item submit">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="zmn-form-submit">提交
                        </button>
                        <button type="button" id="cancel" class="layui-btn layui-btn-primary">取消</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
</div>



